<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('商户会员列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
	<form id="formId" class="row">
		<div class="col-sm-12 search-collapse" style="display: block">
			<label>手机号：</label>
			<input type="text" name="mobile"/>
			<a class="btn btn-primary btn-rounded btn-sm" onclick="query()"><i
					class="fa fa-search"></i>&nbsp;搜索</a>
		</div>

		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table"></table>
		</div>
	</form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
	var prefix = ctx + "operator/member";
	var preflag = false;

	function query() {
		if(preflag) {
			return $.table.search()
		}
		var options = {
			url: prefix + "/lists",
			showSearch: false,
			showRefresh: false,
			showToggle: false,
			showColumns: false,
			singleSelect: true,
			clickToSelect: true,
			columns: [{
				radio: true,
				width: 60
			},
			{
				field: 'mobile',
				title: '会员',
				formatter: function (value, row, index) {
					return value+ "("+row.userName+")"
				}
			}]
		};
		$.table.init(options);
		preflag = true
	};

	function clickToSelect() {
		console.log(1)
	}
	/* 添加用户-选择会员-提交 */
	function submitHandler(index, layero) {
		var rows = $("#bootstrap-table").bootstrapTable('getSelections')
		if (rows.length == 0) {
			$.modal.alertWarning("请至少选择一条记录");
			return;
		}
		$.modal.close();
		// 父页面的方法
		parent.selectMember(rows[0]);
		// 父页面的变量
		// parent.$('#userids').html(rows.join());
	}
</script>
</body>
</html>